package com.tutu.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tutu.commons.pojo.Picture;
import com.tutu.product.mapper.PictureMapper;
import com.tutu.product.service.PictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Program: b2c-cloud-store
 * @Description:
 * @Author: JK.TuTu
 * @ @Version: 1.0
 * @Create: 2022-12-19 17:39
 **/
@Service
public class PictureServiceImpl extends ServiceImpl<PictureMapper, Picture> implements PictureService {

    @Autowired
    private PictureMapper pictureMapper;


    /**
     * 通过商品Id获取商品图片信息
     *
     * @param productId 商品Id
     * @return 返回结果实体对象
     */
    @Override
    public List<Picture> getProductPicturesById(Integer productId) {
        LambdaQueryWrapper<Picture> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Picture::getProductId, productId);
        return pictureMapper.selectList(queryWrapper);
    }
}
